// 仪表盘统计数据类型
export interface DashboardStats {
  // 基础统计
  totalUsers: number;
  totalTrainingPrograms: number;
  totalMajors: number;

  // 用户统计
  userStats: {
    activeUsers: number;
    newUsersThisMonth: number;
    completedProfiles: number;
    pendingProfiles: number;
  };

  // 星途推荐进度统计 (基于stepStatus)
  starProgressStats: {
    notStarted: number;              // stepStatus = 0 未开始
    completedQuestionnaire: number;  // stepStatus = 1 完成答卷/测评
    completedProfile: number;        // stepStatus = 3 完成画像生成
    completedRecommendation: number; // stepStatus = 4 完成星图推荐
    totalStudents: number;
    progressDistribution: Array<{
      step: number;
      stepName: string;
      count: number;
      percentage: number;
    }>;
  };

  // AI助手聊天统计
  chatStats: {
    totalSessions: number;
    activeSessions: number;
    totalMessages: number;
    averageMessagesPerSession: number;
    activeUsersWithChat: number;
    chatUsageRate: number; // 使用聊天功能的用户比例
  };
  
  // 系统统计
  systemStats: {
    totalApiCalls: number;
    averageResponseTime: number;
    errorRate: number;
    uptime: number;
  };
  
  // 趋势数据
  trends: {
    userGrowth: Array<{ date: string; count: number }>;
    programGrowth: Array<{ date: string; count: number }>;
    profileCompletion: Array<{ date: string; count: number }>;
  };
  
  // 分布数据
  distributions: {
    usersByMajor: Array<{ majorName: string; count: number }>;
    usersByProgram: Array<{ programName: string; count: number }>;
  };
}

// 系统状态类型
export interface SystemStatus {
  database: 'healthy' | 'warning' | 'error';
  api: 'healthy' | 'warning' | 'error';
  storage: 'healthy' | 'warning' | 'error';
  cache: 'healthy' | 'warning' | 'error';
  lastUpdated: string;
}

// 最近活动类型
export interface RecentActivity {
  id: string;
  type: 'user_register' | 'profile_generated' | 'program_created' | 'course_added' | 'system_update';
  title: string;
  description: string;
  timestamp: string;
  userId?: string;
  userName?: string;
}

// 性能指标类型
export interface PerformanceMetrics {
  responseTime: {
    avg: number;
    p95: number;
    p99: number;
  };
  throughput: {
    requestsPerSecond: number;
    requestsPerMinute: number;
  };
  errorRate: {
    percentage: number;
    total: number;
  };
  uptime: {
    percentage: number;
    lastDowntime: string;
  };
}

// 用户行为分析类型
export interface UserBehaviorAnalytics {
  pageViews: Array<{ page: string; views: number }>;
  userJourney: Array<{ step: string; completionRate: number }>;
  deviceStats: Array<{ device: string; count: number }>;
  browserStats: Array<{ browser: string; count: number }>;
}

// 内容统计类型
export interface ContentStats {
  questionnaires: {
    total: number;
    published: number;
    draft: number;
    completed: number;
  };
  profiles: {
    generated: number;
    pending: number;
    errorRate: number;
  };
  recommendations: {
    generated: number;
    accepted: number;
    rejected: number;
  };
}
